<?php
class ArrayCollection implements Iterator
{
	protected $data = array();
	
	public function __construct()
	{
		$this->data = array();
	}
	
	public function getItemAt($number)
	{
		return $this->data[$number];
	}
	
	public function addItem($object)
	{
		$this->data[] = $object;
	}
	
	public function __get($property)
	{
		if ($property == 'length')
			return count($this->data);
	}
	
	/* ITERATOR METHODS */
	
	public function rewind() 
	{    
		reset($this->data);
	}

	public function current() 
	{
		$var = current($this->data);
		return $var;
	}

	public function key() 
	{
		$var = key($this->data);
		return $var;
	}

	public function next() 
	{
		$var = next($this->data);
		return $var;
	}

	public function valid() 
	{
		$var = $this->current() !== false;
		return $var;
	}
	
}
?>